﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security;
using webtracuudiem.Truyxuatdulieu;
using System.Web.Security;

namespace webtracuudiem
{
    public partial class trangquanlynganhhoc : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ButThemnganh_Click(object sender, EventArgs e)
        {
            string manganh, tennganh,makhoa;
            manganh = TextBox1.Text;
            tennganh = TextBox2.Text;
            makhoa = TextBox3.Text;
            string sql = "INSERT INTO nganhhoc VALUES('" + manganh + "',N'" + tennganh + "'" + "','" + makhoa + "')";
            TienIchSql.ChayLenhCapNhatDuLieu(sql);
            Response.Redirect(Request.RawUrl);
        }

        protected void ButCapnhat_Click(object sender, EventArgs e)
        {
            string manganh, tennganh,makhoa;
            manganh = TextBox1.Text;
            tennganh = TextBox2.Text;
            makhoa = TextBox3.Text;
            string sql = "UPDATE nganhhoc SET tennganh=N'" + tennganh + "' where manganh='" + manganh + "' and makhoa='" + makhoa + "'";
            TienIchSql.ChayLenhCapNhatDuLieu(sql);
            Response.Redirect(Request.RawUrl);
        }

        protected void ButThemnganh_Click1(object sender, EventArgs e)
        {

        }

        protected void ButThoat_Click(object sender, EventArgs e)
        {
            FormsAuthentication.SignOut();
            Response.Redirect("/Default.aspx");
        }
    }
}